/*
 * @Author: CodeHare
 * @Date: 2023-10-30 10:51:56
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-04-23 16:50:13
 * @Description: EMS参数设置之交流器设置
 */
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:yt_devops/resources/str_res_keys.dart';

class ConverterSetModel {
  final protectParamsController1 = TextEditingController();
  final protectParamsController2 = TextEditingController();
  final protectParamsController3 = TextEditingController();
  final protectParamsController4 = TextEditingController();
  final protectParamsController5 = TextEditingController();
  final protectParamsController6 = TextEditingController();
  final protectParamsController7 = TextEditingController();
  final protectParamsController8 = TextEditingController();
  final protectParamsController9 = TextEditingController();
  final protectParamsController10 = TextEditingController();
  final protectParamsController11 = TextEditingController();
  final protectParamsController12 = TextEditingController();
  final protectParamsController13 = TextEditingController();
  final protectParamsController14 = TextEditingController();
  final protectParamsController15 = TextEditingController();
  final protectParamsController16 = TextEditingController();
  final gridParameterController1 = TextEditingController();
  final gridParameterController2 = TextEditingController();

  /// 变流器保护参数设置列表 Converter protection parameter settings
  List<ConverterParameterItem> get converterProtectionParameterList => [
        ConverterParameterItem(
            ResKey.deviceConverterProtectionParameterSettings.tr,
            ResKey.deviceParameterSetting.toUpperCase(),
            null), //变流器保护参数设置
        ConverterParameterItem(ResKey.deviceGeneralChargingPowerLimit.tr, "kW",
            protectParamsController1), //一般充电功率限值
        ConverterParameterItem(ResKey.deviceSevereChargingPowerLimit.tr, "kW",
            protectParamsController2), //严重充电功率限值
        ConverterParameterItem(ResKey.deviceGeneralInverterPowerLimits.tr, "kW",
            protectParamsController3), //一般逆变功率限值
        ConverterParameterItem(ResKey.deviceSevereInverterPowerLimitation.tr,
            "kW", protectParamsController4), //严重逆变功率限制
        ConverterParameterItem(ResKey.deviceGeneralOverpressureLimit.tr, "V",
            protectParamsController5), //一般过压限值
        ConverterParameterItem(ResKey.deviceSevereOvervoltageLimit.tr, "V",
            protectParamsController6), //严重过压限值
        ConverterParameterItem(ResKey.deviceGeneralUndervoltageLimit.tr, "V",
            protectParamsController7), //一般欠压限值
        ConverterParameterItem(ResKey.deviceSevereUndervoltageLimit.tr, "V",
            protectParamsController8), //严重欠压限值
        ConverterParameterItem(ResKey.deviceGeneralChargingCurrentLimit.tr, "A",
            protectParamsController9), //一般充电电流限值
        ConverterParameterItem(ResKey.deviceSevereChargingCurrentLimit.tr, "A",
            protectParamsController10), //严重充电电流限值
        ConverterParameterItem(ResKey.deviceGeneralInverterCurrentLimitValue.tr,
            "A", protectParamsController11), //一般逆变电流限值
        ConverterParameterItem(ResKey.deviceSeriousInverterCurrentLimit.tr, "A",
            protectParamsController12), //严重逆变电流限值
        ConverterParameterItem(
            ResKey.deviceConverterGeneralOvertemperatureLimit.tr,
            "℃",
            protectParamsController13), //一般过温限值
        ConverterParameterItem(
            ResKey.deviceConverterSevereOvertemperatureLimit.tr,
            "℃",
            protectParamsController14), //严重过温限值
        ConverterParameterItem(
            ResKey.deviceConverterGeneralLowTemperatureLimit.tr,
            "℃",
            protectParamsController15), //一般低温限值
        ConverterParameterItem(
            ResKey.deviceConverterSevereLowTemperatureLimit.tr,
            "℃",
            protectParamsController16), //严重低温限值
      ].toList();

  set converterProtectionParameterList(
      List<ConverterParameterItem> updateList) {
    converterProtectionParameterList = updateList;
  }

  /// 电网参数设置列表
  List<ConverterParameterItem> get converterGridParameterSettingList => [
        ConverterParameterItem(ResKey.deviceGridParameterSetting.tr,
            ResKey.deviceParameterSetting.tr, null), //电网参数设置
        ConverterParameterItem(ResKey.deviceAntiBackflowThreshold.tr, "kW",
            gridParameterController1), //防逆流阈值
        ConverterParameterItem(ResKey.deviceMaximumLoadOfTransformer.tr, "kW",
            gridParameterController2), //变压器最大负荷
      ].toList();

  set converterGridParameterSettingList(
      List<ConverterParameterItem> updateList) {
    converterGridParameterSettingList = updateList;
  }

  ConverterSetModel();
}

class ConverterParameterItem {
  /// 描述
  String label;

  /// 单位
  String unit;

  /// 控制器
  TextEditingController? textEditingController;

  ConverterParameterItem(
    this.label,
    this.unit,
    this.textEditingController,
  );
}
